package com.example.picturestorage.mapper;

import com.example.picturestorage.bean.TestBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface TestMapper {
    @Insert("insert into test_table1(name) values(#{name})")
    void add(String name);

    @Insert("<script>" +
            "insert into test_table1(name) values " +
            "<foreach collection='list'  item='name' separator=',' >" +
            "(#{name})" +
            "</foreach>" +
            "</script>")
    void add2(List<String> names);

    @Insert("insert into tb_test2 (a,b,c,d,e) values(#{a},#{b},#{c},#{d},#{e})")
    int insertTestBean(TestBean testBean);
}
